home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume8 / libhoward / part07 < prev    next >
Encoding:
Text File  |  1989-09-30  |  47.6 KB  |  1,823 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v08i085: libhoward portability library, part 7 of 9
  3. from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  4. Reply-To: howard@dahlbeck.ericsson.se (Howard Gayle)
  5.  
  6. Posting-number: Volume 8, Issue 85
  7. Submitted-by: howard@dahlbeck.ericsson.se (Howard Gayle)
  8. Archive-name: libhoward/part07
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # If this archive is complete, you will see the following message at the end:
  17. #        "End of archive 7 (of 9)."
  18. # Contents:  copy-self.1 freezePch.1 mcalloc.c mcpstr.c mfcopy.3
  19. #   mfcopy.c mfflush.c mfseek.c msgfn.3 new-c.b new-uMake.b prefix.3
  20. #   prefix.c putspn.3 putspn.c qrndu.3 smpdig.c uMakefile yrwk.3
  21. # Wrapped by howard@hasse on Mon Sep 25 07:08:13 1989
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'copy-self.1' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'copy-self.1'\"
  25. else
  26. echo shar: Extracting \"'copy-self.1'\" \(1991 characters\)
  27. sed "s/^X//" >'copy-self.1' <<'END_OF_FILE'
  28. X.\" $Header: copy-self.1,v 1.2 89/09/20 13:58:12 howard Exp $
  29. X.TH COPY-SELF 1 "$Revision: 1.2 $"
  30. X.SH NAME
  31. Xcopy-self \- copy files to files with same names
  32. X.SH SYNOPSIS
  33. X.B copy-self
  34. X.RB [ " \-r " ] 
  35. X.I filename \&.\|.\|.
  36. X.SH COPYRIGHT
  37. XCopyright \(co 1989 Howard Lee Gayle
  38. X.SH DESCRIPTION
  39. X.I copy-self
  40. Xcopies each given file to a temporary file in the same directory.
  41. XIt then renames the temporary file to the old file name.
  42. XThis breaks any links, and results in a file owned by the caller.
  43. XUnless the
  44. X.B \-r
  45. Xoption is used, the file is made writeable by the caller.
  46. XThe caller must have write permission in the directory in which
  47. Xthe file resides.
  48. XIf this directory is group-writeable, then the file is also made
  49. Xgroup-writeable.
  50. X.SH EXAMPLE
  51. X.nf
  52. X   % ls -l t1 t2 t3
  53. X   -r--r--r--  2 foobar         33 Sep  6 09:34 t1
  54. X   -r--r--r--  2 foobar         33 Sep  6 09:34 t2
  55. X   lrwxrwxrwx  1 foobar          2 Sep  6 09:35 t3 -> t1
  56. X   % copy-self t2 t3
  57. X   % ls -l t1 t2 t3
  58. X   -rw-r--r--  1 howard         33 Sep  6 09:34 t1
  59. X   -rw-r--r--  1 howard         33 Sep  6 09:35 t2
  60. X   -rw-r--r--  1 howard         33 Sep  6 09:37 t3
  61. X.fi
  62. X.SH FILES
  63. X.DT
  64. X.nf
  65. X\&.copy-self$$ \- temporary file
  66. X.fi
  67. X.SH LICENSE
  68. XThis program is free software; you can redistribute it and/or modify
  69. Xit under the terms of the GNU General Public License version 1,
  70. Xas published by the Free Software Foundation.
  71. X.PP
  72. XThis program is distributed in the hope that it will be useful,
  73. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  74. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  75. XGNU General Public License for more details.
  76. X.PP
  77. XYou should have received a copy of the GNU General Public License
  78. Xalong with this program; if not, write to the Free Software
  79. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  80. X.SH AUTHOR
  81. XHoward Gayle,
  82. XTN/ETX/T/BG,
  83. XEricsson Telecom AB,
  84. XS-126 25 Stockholm,
  85. XSweden,
  86. Xhoward@ericsson.se,
  87. Xuunet!ericsson.se!howard,
  88. XPhone: +46 8 719 5565,
  89. XFAX: +46 8 719 9598,
  90. XTelex: 14910 ERIC S
  91. END_OF_FILE
  92. if test 1991 -ne `wc -c <'copy-self.1'`; then
  93.     echo shar: \"'copy-self.1'\" unpacked with wrong size!
  94. fi
  95. # end of 'copy-self.1'
  96. fi
  97. if test -f 'freezePch.1' -a "${1}" != "-c" ; then 
  98.   echo shar: Will not clobber existing file \"'freezePch.1'\"
  99. else
  100. echo shar: Extracting \"'freezePch.1'\" \(2189 characters\)
  101. sed "s/^X//" >'freezePch.1' <<'END_OF_FILE'
  102. X.\" $Header: freezePch.1,v 1.2 89/09/25 07:01:32 howard Exp $
  103. X.TH FREEZEPCH 1 "$Revision: 1.2 $"
  104. X.SH NAME
  105. XfreezePch \- make a patch file from one revision to another
  106. X.SH SYNOPSIS
  107. X.B freezePch
  108. X.I old-revision
  109. X.I new-revision
  110. X.SH COPYRIGHT
  111. XCopyright \(co 1989 Howard Lee Gayle
  112. X.SH DESCRIPTION
  113. X.I freezePch
  114. Xwrites on standard output a Bourne shell script that, when
  115. Xexecuted, updates all the source files in a software system
  116. Xfrom those that were in revision
  117. X.I old-revision
  118. Xof the FREEZE file to those that were in revision
  119. X.I new-revision
  120. Xof the FREEZE file.
  121. XIt first checks out revision
  122. X.I new-revision
  123. Xof FREEZE.
  124. XIt then writes commands to remove any files in
  125. X.I old-revision
  126. Xbut not in
  127. X.IR new-revision .
  128. XThe old FREEZE file is always removed.
  129. XNext,
  130. X.I freezePch
  131. Xcalls shar to write a shar file for any files in
  132. X.I new-revision
  133. Xbut not in
  134. X.IR old-revision .
  135. XA complete copy of the new FREEZE is always sent as a shar file.
  136. XFinally,
  137. X.I freezePch
  138. Xwrites a patch command for every file that changed from
  139. X.I old-revision
  140. Xto
  141. X.IR new-revision .
  142. X.SH EXAMPLE
  143. X.nf
  144. X   % freezePch 1.7 2.4 > patchfile
  145. X.fi
  146. X.SH FILES
  147. X.DT
  148. X.nf
  149. XFREEZE \- freeze file
  150. XRCS/FREEZE,v \- RCS master freeze file
  151. X/tmp/frzpch$$? \- temporary files
  152. X.fi
  153. X.SH "SEE ALSO"
  154. X.IR freeze (1),
  155. X.IR patch (1),
  156. X.IR rcsdiff (1),
  157. X.IR shar (1).
  158. X.SH BUGS
  159. XIf the output is too big, you have to split it into mulitple
  160. Xparts by hand.
  161. X.SH LICENSE
  162. XThis program is free software; you can redistribute it and/or modify
  163. Xit under the terms of the GNU General Public License version 1,
  164. Xas published by the Free Software Foundation.
  165. X.PP
  166. XThis program is distributed in the hope that it will be useful,
  167. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  168. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  169. XGNU General Public License for more details.
  170. X.PP
  171. XYou should have received a copy of the GNU General Public License
  172. Xalong with this program; if not, write to the Free Software
  173. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  174. X.SH AUTHOR
  175. XHoward Gayle,
  176. XTN/ETX/T/BG,
  177. XEricsson Telecom AB,
  178. XS-126 25 Stockholm,
  179. XSweden,
  180. Xhoward@ericsson.se,
  181. Xuunet!ericsson.se!howard,
  182. XPhone: +46 8 719 5565,
  183. XFAX: +46 8 719 9598,
  184. XTelex: 14910 ERIC S
  185. END_OF_FILE
  186. if test 2189 -ne `wc -c <'freezePch.1'`; then
  187.     echo shar: \"'freezePch.1'\" unpacked with wrong size!
  188. fi
  189. # end of 'freezePch.1'
  190. fi
  191. if test -f 'mcalloc.c' -a "${1}" != "-c" ; then 
  192.   echo shar: Will not clobber existing file \"'mcalloc.c'\"
  193. else
  194. echo shar: Extracting \"'mcalloc.c'\" \(2098 characters\)
  195. sed "s/^X//" >'mcalloc.c' <<'END_OF_FILE'
  196. X/*
  197. X * mcalloc - calloc() + malf1()
  198. X */
  199. X
  200. X#ifndef lint
  201. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  202. X#endif lint
  203. X
  204. X/*
  205. X * This program is free software; you can redistribute it and/or modify
  206. X * it under the terms of the GNU General Public License version 1,
  207. X * as published by the Free Software Foundation.
  208. X *
  209. X * This program is distributed in the hope that it will be useful,
  210. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  211. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  212. X * GNU General Public License for more details.
  213. X *
  214. X * You should have received a copy of the GNU General Public License
  215. X * along with this program; if not, write to the Free Software
  216. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  217. X */
  218. X
  219. X#include <stdio.h>
  220. X#include <howard/port.h>
  221. X#include <howard/version.h>
  222. X
  223. XMODVER ("@(#)$Header: mcalloc.c,v 1.5 89/08/13 10:19:24 howard Exp $");
  224. X
  225. X#include <howard/malf.h>
  226. X#include <howard/registers.i>
  227. X
  228. XPUBLIC voidPT mcalloc (n, s, es)
  229. Xunsigned n;  /* Number of elements.*/
  230. Xunsigned s;  /* Size of each element.*/
  231. XbStrT    es; /* String for error message.*/
  232. X
  233. X/* Function:
  234. X *    
  235. X * Algorithm:
  236. X *    Call calloc().  Call malf1() if not space.
  237. X * Returns:
  238. X *    
  239. X * Notes:
  240. X *    
  241. X */
  242. X{
  243. Xextern cStrT  calloc();                   /* malloc(3) */
  244. XR1     voidPT r = (voidPT) calloc (n, s); /* Return.*/
  245. X
  246. Xif (((voidPT) NULL) == r)
  247. X   malf1 ("Can not allocate %u * %u = %u bytes for %s", n, s, n * s, es);
  248. Xreturn (r);
  249. X}
  250. X
  251. X#ifdef TEST
  252. X#include <howard/usage.h>
  253. X
  254. XMAINVER ("@(#)$Header: mcalloc.c,v 1.5 89/08/13 10:19:24 howard Exp $");
  255. XUSAGE ("nelem elsize");
  256. X
  257. X#include <howard/a2.h>
  258. X
  259. XPUBLIC int main (argc, argv)
  260. Xint    argc; /* Number of arguments.*/
  261. XbStrT *argv; /* Points to array of argument strings.*/
  262. X{
  263. Xif (3 != argc) usage();
  264. X(void) mcalloc (
  265. X   ma2u (argv[1], NULBSTR, FALSE, S("Number of elements"), (bStrT *) NULL),
  266. X   ma2u (argv[2], NULBSTR, FALSE, S("Element size"),       (bStrT *) NULL),
  267. X   S("test"));
  268. X(void) puts ("Success");
  269. Xmfflush (stdout, "Standard Output");
  270. Xexit (SUCCESS);
  271. X
  272. X#ifdef lint
  273. Xreturn (SUCCESS);
  274. X#endif
  275. X}
  276. X#endif
  277. END_OF_FILE
  278. if test 2098 -ne `wc -c <'mcalloc.c'`; then
  279.     echo shar: \"'mcalloc.c'\" unpacked with wrong size!
  280. fi
  281. # end of 'mcalloc.c'
  282. fi
  283. if test -f 'mcpstr.c' -a "${1}" != "-c" ; then 
  284.   echo shar: Will not clobber existing file \"'mcpstr.c'\"
  285. else
  286. echo shar: Extracting \"'mcpstr.c'\" \(2063 characters\)
  287. sed "s/^X//" >'mcpstr.c' <<'END_OF_FILE'
  288. X/*
  289. X * mcpstr - make a new copy of a string and check for errors
  290. X */
  291. X
  292. X#ifndef lint
  293. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  294. X#endif lint
  295. X
  296. X/*
  297. X * This program is free software; you can redistribute it and/or modify
  298. X * it under the terms of the GNU General Public License version 1,
  299. X * as published by the Free Software Foundation.
  300. X *
  301. X * This program is distributed in the hope that it will be useful,
  302. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  303. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  304. X * GNU General Public License for more details.
  305. X *
  306. X * You should have received a copy of the GNU General Public License
  307. X * along with this program; if not, write to the Free Software
  308. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  309. X */
  310. X
  311. X#include <stdio.h>
  312. X#include <howard/port.h>
  313. X#include <howard/version.h>
  314. X
  315. XMODVER ("@(#)$Header: mcpstr.c,v 1.4 89/08/13 15:27:43 howard Exp $");
  316. X
  317. X#include <string.h>
  318. X#include <howard/malf.h>
  319. X#include <howard/registers.i>
  320. X
  321. XPUBLIC bStrT mcpstr (s)
  322. XR2 bStrT s; /* Old string.*/
  323. X
  324. X/* Function:
  325. X *    Allocate memory for string s and
  326. X *    copy it into the newly allocated memory.
  327. X *    If the memory allocation fails, output an error message and exit.
  328. X * Algorithm:
  329. X *    Call malloc(), then strcpy().
  330. X * Returns:
  331. X *    A pointer to the newly allocated memory.
  332. X *    No return if allocation fails.
  333. X * Notes:
  334. X *    
  335. X */
  336. X{
  337. XR1     bStrT n;        /* New string.*/
  338. Xextern cStrT malloc(); /* (3).*/
  339. X
  340. Xn = (bStrT) malloc (1 + (unsigned) strlen ((cStrT) s));
  341. Xif (NULBSTR == n)
  342. X   malf1 ("mcpstr: Can not allocate memory to copy string %s", s);
  343. XSTRCPY (n, s);
  344. Xreturn (n);
  345. X}
  346. X
  347. X#ifdef TEST
  348. X#include <howard/usage.h>
  349. X
  350. XMAINVER ("@(#)$Header: mcpstr.c,v 1.4 89/08/13 15:27:43 howard Exp $");
  351. XUSAGE ("string");
  352. X
  353. XPUBLIC int main (argc, argv)
  354. Xint    argc; /* Number of arguments.*/
  355. XbStrT *argv; /* Points to array of argument strings.*/
  356. X{
  357. Xif (2 != argc) usage();
  358. XPUTS (mcpstr (argv[1]));
  359. Xmfflush (stdout, S("Standard Output"));
  360. Xexit (SUCCESS);
  361. X
  362. X#ifdef lint
  363. Xreturn (SUCCESS);
  364. X#endif
  365. X}
  366. X#endif
  367. END_OF_FILE
  368. if test 2063 -ne `wc -c <'mcpstr.c'`; then
  369.     echo shar: \"'mcpstr.c'\" unpacked with wrong size!
  370. fi
  371. # end of 'mcpstr.c'
  372. fi
  373. if test -f 'mfcopy.3' -a "${1}" != "-c" ; then 
  374.   echo shar: Will not clobber existing file \"'mfcopy.3'\"
  375. else
  376. echo shar: Extracting \"'mfcopy.3'\" \(2128 characters\)
  377. sed "s/^X//" >'mfcopy.3' <<'END_OF_FILE'
  378. X.\" $Header: mfcopy.3,v 1.1 89/08/13 15:45:31 howard Exp $
  379. X.TH MFCOPY "3 -lhoward" "$Revision: 1.1 $" "Howard\'s C library" "Howard\'s C library"
  380. X.SH NAME
  381. Xmfcopy \- copy bytes from one stream to another
  382. X.SH SYNOPSIS
  383. X.nf
  384. X.BR "#include <" stdio.h ">"
  385. X.BR "#include <" howard/port.h ">"
  386. X.BR "#include <" howard/malf.h ">"
  387. X.fi
  388. X.LP
  389. X.BR "void " "mfcopy ("
  390. X.IR fromStream ,
  391. X.IR fromExit ,
  392. X.IR fromName ,
  393. X.IR toStream ,
  394. X.IR toExit ,
  395. X.IR toName )
  396. X.nf
  397. X.RI "streamT " fromStream ;
  398. X.BI "int " fromExit;
  399. X.RI "bStrT " fromName ;
  400. X.RI "streamT " toStream ;
  401. X.BI "int " toExit;
  402. X.RI "bStrT " toName ;
  403. X.fi
  404. X.SH COPYRIGHT
  405. XCopyright \(co 1989 Howard Lee Gayle
  406. X.SH DESCRIPTION
  407. X.I mfcopy
  408. Xcopies bytes from
  409. X.I fromStream
  410. Xto
  411. X.I toStream
  412. Xuntil end of file on
  413. X.IR fromStream .
  414. XIn case of error on
  415. X.IR fromStream ,
  416. Xit calls
  417. X.I malf
  418. Xwith
  419. X.I fromExit
  420. Xas exit code and with an error message including
  421. X.IR fromName .
  422. XIn case of error on
  423. X.IR toStream ,
  424. Xit calls
  425. X.I malf
  426. Xwith
  427. X.I toExit
  428. Xas exit code and with an error message including
  429. X.IR toName .
  430. X.SH EXAMPLE
  431. XTo copy from standard input to standard output and exit with exit
  432. Xcode 1 on error:
  433. X.nf
  434. X   mfcopy (stdin, 1, S("Standard Input"), stdout, 1, S("Standard Output"));
  435. X.fi
  436. X.SH "SEE ALSO"
  437. X.IR malf "(3 -lhoward)."
  438. X.SH BUGS
  439. XIt should work in big blocks, but right now it copies one byte at a time.
  440. X.SH LICENSE
  441. XThis program is free software; you can redistribute it and/or modify
  442. Xit under the terms of the GNU General Public License version 1,
  443. Xas published by the Free Software Foundation.
  444. X.PP
  445. XThis program is distributed in the hope that it will be useful,
  446. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  447. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  448. XGNU General Public License for more details.
  449. X.PP
  450. XYou should have received a copy of the GNU General Public License
  451. Xalong with this program; if not, write to the Free Software
  452. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  453. X.SH AUTHOR
  454. XHoward Gayle,
  455. XTN/ETX/T/BG,
  456. XEricsson Telecom AB,
  457. XS-126 25 Stockholm,
  458. XSweden,
  459. Xhoward@ericsson.se,
  460. Xuunet!ericsson.se!howard,
  461. XPhone: +46 8 719 5565,
  462. XFAX: +46 8 719 9598,
  463. XTelex: 14910 ERIC S
  464. END_OF_FILE
  465. if test 2128 -ne `wc -c <'mfcopy.3'`; then
  466.     echo shar: \"'mfcopy.3'\" unpacked with wrong size!
  467. fi
  468. # end of 'mfcopy.3'
  469. fi
  470. if test -f 'mfcopy.c' -a "${1}" != "-c" ; then 
  471.   echo shar: Will not clobber existing file \"'mfcopy.c'\"
  472. else
  473. echo shar: Extracting \"'mfcopy.c'\" \(2099 characters\)
  474. sed "s/^X//" >'mfcopy.c' <<'END_OF_FILE'
  475. X/*
  476. X * mfcopy - copy stream and handle errors
  477. X */
  478. X
  479. X#ifndef lint
  480. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  481. X#endif lint
  482. X
  483. X/*
  484. X * This program is free software; you can redistribute it and/or modify
  485. X * it under the terms of the GNU General Public License version 1,
  486. X * as published by the Free Software Foundation.
  487. X *
  488. X * This program is distributed in the hope that it will be useful,
  489. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  490. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  491. X * GNU General Public License for more details.
  492. X *
  493. X * You should have received a copy of the GNU General Public License
  494. X * along with this program; if not, write to the Free Software
  495. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  496. X */
  497. X
  498. X#include <stdio.h>
  499. X#include <howard/port.h>
  500. X#include <howard/version.h>
  501. X
  502. XMODVER ("@(#)$Header: mfcopy.c,v 1.4 89/08/13 15:37:56 howard Exp $");
  503. X
  504. X#include <howard/malf.h>
  505. X#include <howard/registers.i>
  506. X
  507. XPUBLIC void mfcopy (fs, fx, fn, ts, tx, tn)
  508. XR2 streamT fs; /* From stream.*/
  509. X   int     fx; /* From exit code (0 = no exit).*/
  510. X   bStrT   fn; /* From file name.*/
  511. XR3 streamT ts; /* To stream.*/
  512. X   int     tx; /* To exit code (0 = no exit).*/
  513. X   bStrT   tn; /* To file name.*/
  514. X
  515. X/* Function:
  516. X *    
  517. X * Algorithm:
  518. X *    Copy byte-by-byte.  Check for errors.
  519. X * Returns:
  520. X *    
  521. X * Notes:
  522. X *    1) Copying in big blocks would be faster.
  523. X */
  524. X{
  525. XR1     rcharT c; /* Current character.*/
  526. Xstatic char   eRead  [] = "%s: Read error";
  527. Xstatic char   eWrite [] = "%s: Write error";
  528. X
  529. Xwhile (EOF != (c = getc (fs)))
  530. X   PUTC (c, ts);
  531. Xif (ferror (fs)) malf (fx, eRead, fn);
  532. XFFLUSH (ts);
  533. Xif (ferror (ts)) malf (tx, eWrite, tn);
  534. X}
  535. X
  536. X#ifdef TEST
  537. X#include <howard/usage.h>
  538. X
  539. XMAINVER ("@(#)$Header: mfcopy.c,v 1.4 89/08/13 15:37:56 howard Exp $");
  540. XUSAGE ("");
  541. X
  542. XPUBLIC int main (argc, argv)
  543. Xint    argc; /* Number of arguments.*/
  544. XbStrT *argv; /* Points to array of argument strings.*/
  545. X{
  546. Xif (1 != argc) usage();
  547. Xmfcopy (stdin, 0, S("Standard Input"), stdout, 0, S("Standard Output"));
  548. Xexit (SUCCESS);
  549. X
  550. X#ifdef lint
  551. Xreturn (SUCCESS);
  552. X#endif
  553. X}
  554. X#endif
  555. END_OF_FILE
  556. if test 2099 -ne `wc -c <'mfcopy.c'`; then
  557.     echo shar: \"'mfcopy.c'\" unpacked with wrong size!
  558. fi
  559. # end of 'mfcopy.c'
  560. fi
  561. if test -f 'mfflush.c' -a "${1}" != "-c" ; then 
  562.   echo shar: Will not clobber existing file \"'mfflush.c'\"
  563. else
  564. echo shar: Extracting \"'mfflush.c'\" \(1574 characters\)
  565. sed "s/^X//" >'mfflush.c' <<'END_OF_FILE'
  566. X/*
  567. X * mfflush - flush stream and call malf1 on error
  568. X */
  569. X
  570. X#ifndef lint
  571. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  572. X#endif lint
  573. X
  574. X/*
  575. X * This program is free software; you can redistribute it and/or modify
  576. X * it under the terms of the GNU General Public License version 1,
  577. X * as published by the Free Software Foundation.
  578. X *
  579. X * This program is distributed in the hope that it will be useful,
  580. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  581. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  582. X * GNU General Public License for more details.
  583. X *
  584. X * You should have received a copy of the GNU General Public License
  585. X * along with this program; if not, write to the Free Software
  586. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  587. X */
  588. X
  589. X#include <stdio.h>
  590. X#include <howard/port.h>
  591. X#include <howard/version.h>
  592. X
  593. XMODVER ("@(#)$Header: mfflush.c,v 1.4 89/08/13 14:59:43 howard Exp $");
  594. X
  595. X#include <howard/malf.h>
  596. X#include <howard/registers.i>
  597. X
  598. XPUBLIC void mfflush (s, n)
  599. XR1 streamT s; /* Stream to flush.*/
  600. X   bStrT   n; /* File name, for possible error message.*/
  601. X
  602. X/* Function:
  603. X *    Flush s.  On write error call malf1().
  604. X * Algorithm:
  605. X *    
  606. X * Notes:
  607. X *    
  608. X */
  609. X{
  610. XFFLUSH (s);
  611. Xif (ferror (s)) malf1 ("%s: Write error", n);
  612. X}
  613. X
  614. X#ifdef TEST
  615. X#include <howard/usage.h>
  616. X
  617. XMAINVER ("@(#)$Header: mfflush.c,v 1.4 89/08/13 14:59:43 howard Exp $");
  618. XUSAGE ("");
  619. X
  620. X#include <howard/malf.h>
  621. X
  622. XPUBLIC int main ()
  623. X{
  624. XPUTS ("mfflush() works!");
  625. Xmfflush (stdout, S("Standard Output"));
  626. Xexit (SUCCESS);
  627. X
  628. X#ifdef lint
  629. Xreturn (SUCCESS);
  630. X#endif
  631. X}
  632. X#endif
  633. END_OF_FILE
  634. if test 1574 -ne `wc -c <'mfflush.c'`; then
  635.     echo shar: \"'mfflush.c'\" unpacked with wrong size!
  636. fi
  637. # end of 'mfflush.c'
  638. fi
  639. if test -f 'mfseek.c' -a "${1}" != "-c" ; then 
  640.   echo shar: Will not clobber existing file \"'mfseek.c'\"
  641. else
  642. echo shar: Extracting \"'mfseek.c'\" \(1905 characters\)
  643. sed "s/^X//" >'mfseek.c' <<'END_OF_FILE'
  644. X/*
  645. X * mfseek - fseek() + malf1()
  646. X */
  647. X
  648. X#ifndef lint
  649. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  650. X#endif lint
  651. X
  652. X/*
  653. X * This program is free software; you can redistribute it and/or modify
  654. X * it under the terms of the GNU General Public License version 1,
  655. X * as published by the Free Software Foundation.
  656. X *
  657. X * This program is distributed in the hope that it will be useful,
  658. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  659. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  660. X * GNU General Public License for more details.
  661. X *
  662. X * You should have received a copy of the GNU General Public License
  663. X * along with this program; if not, write to the Free Software
  664. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  665. X */
  666. X
  667. X#include <stdio.h>
  668. X#include <howard/port.h>
  669. X#include <howard/version.h>
  670. X
  671. XMODVER ("@(#)$Header: mfseek.c,v 1.4 89/08/13 15:18:44 howard Exp $");
  672. X
  673. X#include <howard/malf.h>
  674. X#include <howard/registers.i>
  675. X
  676. XPUBLIC void mfseek (s, o, p, n)
  677. XstreamT s; /* Stream to seek on.*/
  678. Xlong    o; /* Offset.*/
  679. Xint     p; /* Type of seek.*/
  680. XbStrT   n; /* File name.*/
  681. X
  682. X/* Function:
  683. X *    
  684. X * Algorithm:
  685. X *    Call fseek().  Call malf1() on error.
  686. X * Returns:
  687. X *    
  688. X * Notes:
  689. X *    
  690. X */
  691. X{
  692. Xif (fseek (s, o, p)) malf1 ("%s: Seek error, offset %ld, ptrname %d", n, o, p);
  693. X}
  694. X
  695. X#ifdef TEST
  696. X#include <howard/usage.h>
  697. X
  698. XMAINVER ("@(#)$Header: mfseek.c,v 1.4 89/08/13 15:18:44 howard Exp $");
  699. XUSAGE ("file offset");
  700. X
  701. X#include <howard/a2.h>
  702. X
  703. XPUBLIC int main (argc, argv)
  704. Xint    argc; /* Number of arguments.*/
  705. XbStrT *argv; /* Points to array of argument strings.*/
  706. X{
  707. XstreamT f; /* Input stream.*/
  708. X
  709. Xif (3 != argc) usage();
  710. Xf = mfopen (argv[1], "r");
  711. Xmfseek (f,
  712. X        ma2l (argv[2], NULBSTR, FALSE, S("Offset"), (bStrT *) NULL),
  713. X        0, argv[1]);
  714. Xmfcopy (f, 0, argv[1], stdout, 1, S("Standard Output"));
  715. Xexit (SUCCESS);
  716. X
  717. X#ifdef lint
  718. Xreturn (SUCCESS);
  719. X#endif
  720. X}
  721. X#endif
  722. END_OF_FILE
  723. if test 1905 -ne `wc -c <'mfseek.c'`; then
  724.     echo shar: \"'mfseek.c'\" unpacked with wrong size!
  725. fi
  726. # end of 'mfseek.c'
  727. fi
  728. if test -f 'msgfn.3' -a "${1}" != "-c" ; then 
  729.   echo shar: Will not clobber existing file \"'msgfn.3'\"
  730. else
  731. echo shar: Extracting \"'msgfn.3'\" \(1920 characters\)
  732. sed "s/^X//" >'msgfn.3' <<'END_OF_FILE'
  733. X.\" $Header: msgfn.3,v 1.2 89/08/21 08:37:19 howard Exp $
  734. X.TH MSGFN "3 -lhoward" "$Revision: 1.2 $" "Howard\'s C library" "Howard\'s C library"
  735. X.SH NAME
  736. Xmsgfn \- extract full name from mail message or news article header
  737. X.SH SYNOPSIS
  738. X.nf
  739. X.BR "#include <" stdio.h ">"
  740. X.BR "#include <" howard/port.h ">"
  741. X.BR "#include <" howard/malf.h ">"
  742. X.fi
  743. X.LP
  744. XboolT msgfn (
  745. X.IR address ,
  746. X.IR buffer )
  747. X.nf
  748. X.RI "bStrT " address ;
  749. X.RI "bStrT " buffer ;
  750. X.fi
  751. X.SH COPYRIGHT
  752. XCopyright \(co 1989 Howard Lee Gayle
  753. X.SH DESCRIPTION
  754. X.I address
  755. Xis the value of an address header
  756. X.RI ( "e.g."
  757. XFrom:)
  758. Xin a mail message or news article.
  759. X.I msgfn
  760. Xtries to find a full name in this, and copies it into
  761. X.I buffer.
  762. XIf
  763. X.I address
  764. Xcontains a nonempty string in double quotes, that is taken as the full name.
  765. XOtherwise, a nonempty string in parentheses is taken.
  766. XOtherwise, a nonempty string is angle brackets is removed, including the angle
  767. Xbrackets, and the remaining string is taken, less any leading and trailing
  768. Xspaces.
  769. X.SH RETURNS
  770. XTRUE if a full name was copied, otherwise FALSE.
  771. X.SH BUGS
  772. XDouble-quoted strings are not always full names.
  773. X.SH LICENSE
  774. XThis program is free software; you can redistribute it and/or modify
  775. Xit under the terms of the GNU General Public License version 1,
  776. Xas published by the Free Software Foundation.
  777. X.PP
  778. XThis program is distributed in the hope that it will be useful,
  779. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  780. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  781. XGNU General Public License for more details.
  782. X.PP
  783. XYou should have received a copy of the GNU General Public License
  784. Xalong with this program; if not, write to the Free Software
  785. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  786. X.SH AUTHOR
  787. XHoward Gayle,
  788. XTN/ETX/T/BG,
  789. XEricsson Telecom AB,
  790. XS-126 25 Stockholm,
  791. XSweden,
  792. Xhoward@ericsson.se,
  793. Xuunet!ericsson.se!howard,
  794. XPhone: +46 8 719 5565,
  795. XFAX: +46 8 719 9598,
  796. XTelex: 14910 ERIC S
  797. END_OF_FILE
  798. if test 1920 -ne `wc -c <'msgfn.3'`; then
  799.     echo shar: \"'msgfn.3'\" unpacked with wrong size!
  800. fi
  801. # end of 'msgfn.3'
  802. fi
  803. if test -f 'new-c.b' -a "${1}" != "-c" ; then 
  804.   echo shar: Will not clobber existing file \"'new-c.b'\"
  805. else
  806. echo shar: Extracting \"'new-c.b'\" \(2256 characters\)
  807. sed "s/^X//" >'new-c.b' <<'END_OF_FILE'
  808. X  
  809. X# new-c.b - create a new C program source file from a prototype
  810. X#
  811. X# $Header: new-c.b,v 1.1 89/09/21 18:32:17 howard Exp $
  812. X#
  813. X# Copyright 1989 Howard Lee Gayle
  814. X# This file is written in the ISO 8859/1 character set.
  815. X#
  816. X# This program is free software; you can redistribute it and/or modify
  817. X# it under the terms of the GNU General Public License version 1,
  818. X# as published by the Free Software Foundation.
  819. X#
  820. X# This program is distributed in the hope that it will be useful,
  821. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  822. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  823. X# GNU General Public License for more details.
  824. X#
  825. X# You should have received a copy of the GNU General Public License
  826. X# along with this program; if not, write to the Free Software
  827. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  828. X#
  829. X# Shell variables:
  830. X# c - ' *'
  831. X# d - '$'
  832. X# f - steps through files to create
  833. X# u - usage string
  834. X
  835. XCMDNAME=new-c
  836. Xexport CMDNAME
  837. Xu="Usage: $CMDNAME file..."
  838. Xif [ $# -eq 0 ]
  839. Xthen
  840. X   echo "$u" 1>&2
  841. X   exit 1
  842. Xfi
  843. Xc=' *'
  844. Xd='$'
  845. Xfor f
  846. Xdo
  847. X   cat << EOF > "$f"
  848. X/*
  849. X$c $f - 
  850. X */
  851. X
  852. XEOF
  853. X   if [ "$NEWTEXTPATH" ]
  854. X   then
  855. X      cat-path "$NEWTEXTPATH" new-c.txt >> "$f"
  856. X   fi
  857. X   cat << 'EOF' >> "$f"
  858. X#include <stdio.h>
  859. X#include <howard/port.h>
  860. X#include <howard/version.h>
  861. X#include <howard/usage.h>
  862. X
  863. XMAINVER ("@(#)$Header: new-c.b,v 1.1 89/09/21 18:32:17 howard Exp $");
  864. XUSAGE ("");
  865. X
  866. X#include <howard/malf.h>
  867. X#include <howard/registers.i>
  868. X
  869. XPRIVATE char eIntern[] = "Internal error %s";
  870. X
  871. X/* main - main function                            */
  872. X
  873. XPUBLIC int main (argc, argv)
  874. Xint    argc; /* Number of arguments.*/
  875. XbStrT *argv; /* Points to array of argument strings.*/
  876. X
  877. X/* Function:
  878. X *    
  879. X * Algorithm:
  880. X *    
  881. X * Notes:
  882. X *    
  883. X */
  884. X
  885. X{
  886. XrcharT c; /* Option letter.*/
  887. XbStrT cp; /* Steps through args.*/
  888. Xextern int optind; /* See getopt (3).*/
  889. Xextern cStrT optarg; /* See getopt (3).*/
  890. X
  891. Xwhile (EOF != (c = getopt (argc, (cStrT *) argv, "")))
  892. X   {
  893. X   switch (c)
  894. X      {
  895. X      case '?':
  896. X         usage();
  897. X         break;
  898. X      default:
  899. X         malf1 (eIntern, "main 1");
  900. X         break;
  901. X      }
  902. X   }
  903. Xargv += optind;
  904. Xcp = *argv++;
  905. Xif (NULBSTR == cp) usage();
  906. X
  907. Xmfflush (stdout, S("Standard Output"));
  908. Xexit (SUCCESS);
  909. X
  910. X#ifdef lint
  911. Xreturn (SUCCESS);
  912. X#endif
  913. X}
  914. XEOF
  915. Xdone
  916. END_OF_FILE
  917. if test 2256 -ne `wc -c <'new-c.b'`; then
  918.     echo shar: \"'new-c.b'\" unpacked with wrong size!
  919. fi
  920. # end of 'new-c.b'
  921. fi
  922. if test -f 'new-uMake.b' -a "${1}" != "-c" ; then 
  923.   echo shar: Will not clobber existing file \"'new-uMake.b'\"
  924. else
  925. echo shar: Extracting \"'new-uMake.b'\" \(1911 characters\)
  926. sed "s/^X//" >'new-uMake.b' <<'END_OF_FILE'
  927. X  
  928. X# new-uMake.b - create a new uMakefile from a prototype
  929. X#
  930. X# $Header: new-uMake.b,v 1.1 89/09/21 18:14:52 howard Exp $
  931. X#
  932. X# Copyright 1989 Howard Lee Gayle
  933. X# This file is written in the ISO 8859/1 character set.
  934. X#
  935. X# This program is free software; you can redistribute it and/or modify
  936. X# it under the terms of the GNU General Public License version 1,
  937. X# as published by the Free Software Foundation.
  938. X#
  939. X# This program is distributed in the hope that it will be useful,
  940. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  941. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  942. X# GNU General Public License for more details.
  943. X#
  944. X# You should have received a copy of the GNU General Public License
  945. X# along with this program; if not, write to the Free Software
  946. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  947. X#
  948. X# Shell variables:
  949. X# c - '#'
  950. X# d - '$'
  951. X# f - steps through files to create
  952. X# u - usage string
  953. X
  954. XCMDNAME=new-uMake
  955. Xexport CMDNAME
  956. Xu="Usage: $CMDNAME file..."
  957. Xif [ $# -eq 0 ]
  958. Xthen
  959. X   echo "$u" 1>&2
  960. X   exit 1
  961. Xfi
  962. Xc='#'
  963. Xd='$'
  964. Xfor f
  965. Xdo
  966. X   cat << EOF > "$f"
  967. X$c $f - micro GNU makefile for ~
  968. X$c
  969. X$c ${d}Header$d
  970. X$c
  971. XEOF
  972. X   if [ "$NEWTEXTPATH" ]
  973. X   then
  974. X      cat-path "$NEWTEXTPATH" new.txt | sed -e "s;^;$c ;" >> "$f"
  975. X   fi
  976. X   cat << 'EOF' >> "$f"
  977. X
  978. Xinclude MakeCommon
  979. X
  980. X# Commands:
  981. X
  982. X# Make depend file that shows include files that C programs use.
  983. XDEPEND=mkCIncl
  984. X
  985. X# Make FREEZE.*.
  986. XMKFREEZE=mkFreeze
  987. X
  988. X# Sources:
  989. XCS := $(filter %.c,$(SRCS))
  990. XHS := $(filter %.h,$(SRCS))
  991. X
  992. X# Targets:
  993. Xit = FREEZE.i
  994. X
  995. Xtargets := $(it) Makefile depend
  996. X
  997. Xifdef WORK
  998. X.DEFAULT:
  999. X    $(UNCMPRS) $@
  1000. Xelse # WORK
  1001. X.DEFAULT:
  1002. X    $(DISTI) $@ $(DISTDIR)
  1003. Xendif # WORK
  1004. X
  1005. X.SUFFIXES:
  1006. X.PHONY: default
  1007. X
  1008. Xdefault: $(targets)
  1009. X
  1010. Xifndef WORK
  1011. XMakefile: $(DD)/Makefile
  1012. X    $(DISTI) $@ $(DD)
  1013. Xendif # WORK
  1014. X
  1015. Xdepend: $(CS) $(HS) $(it)
  1016. X    $(DEPEND) "$(INCLUDES)" $(CS) > $@
  1017. X
  1018. XFREEZE.i: FREEZE
  1019. X    $(RM) FREEZE.*
  1020. X    $(MKFREEZE)
  1021. X    $(CHMOD) a=r FREEZE.*
  1022. XEOF
  1023. Xdone
  1024. END_OF_FILE
  1025. if test 1911 -ne `wc -c <'new-uMake.b'`; then
  1026.     echo shar: \"'new-uMake.b'\" unpacked with wrong size!
  1027. fi
  1028. # end of 'new-uMake.b'
  1029. fi
  1030. if test -f 'prefix.3' -a "${1}" != "-c" ; then 
  1031.   echo shar: Will not clobber existing file \"'prefix.3'\"
  1032. else
  1033. echo shar: Extracting \"'prefix.3'\" \(1986 characters\)
  1034. sed "s/^X//" >'prefix.3' <<'END_OF_FILE'
  1035. X.\" $Header: prefix.3,v 1.4 89/08/19 10:38:38 howard Exp $
  1036. X.TH PREFIX "3 -lhoward" "$Revision: 1.4 $" "Howard\'s C library" "Howard\'s C library"
  1037. X.SH NAME
  1038. Xprefix, prefxi \- test if one string is prefix of another
  1039. X.SH SYNOPSIS
  1040. X.nf
  1041. X.BR "#include <" stdio.h ">"
  1042. X.BR "#include <" howard/port.h ">"
  1043. X.BR "#include <" howard/malf.h ">"
  1044. X.fi
  1045. X.LP
  1046. X.RI "bStrT prefix (" "pfx" ", " str ")"
  1047. X.nf
  1048. X.RI "bStrT " pfx ";"
  1049. X.RI "bStrT " str ";"
  1050. X.fi
  1051. X.LP
  1052. X.RI "bStrT prefxi (" "pfx" ", " str ")"
  1053. X.nf
  1054. X.RI "bStrT " pfx ";"
  1055. X.RI "bStrT " str ";"
  1056. X.fi
  1057. X.SH COPYRIGHT
  1058. XCopyright \(co 1989 Howard Lee Gayle
  1059. X.SH DESCRIPTION
  1060. X.I prefix
  1061. Xtests if string
  1062. X.I pfx
  1063. Xis a prefix of string
  1064. X.IR str .
  1065. XIf so, it returns a pointer to the byte in
  1066. X.I str
  1067. Xjust after the byte matching the last byte of
  1068. X.IR pfx .
  1069. XIf
  1070. X.I pfx
  1071. Xis not a prefix of string, then
  1072. X.I prefix
  1073. Xreturns NULL.
  1074. X.PP
  1075. X.I prefxi
  1076. Xis like
  1077. X.IR prefix ,
  1078. Xexcept that it ignores case (upper or lower).
  1079. X.SH EXAMPLE
  1080. XThe following code fragment stupidifies string
  1081. X.IR s .
  1082. XFor example, if
  1083. X.I s
  1084. Xis "smart toaster" then it will print "toaster", but if
  1085. X.I s
  1086. Xis already stupid then it is printed unchanged.
  1087. X.nf
  1088. X   r = prefix ("smart ", s);
  1089. X   puts (NULBSTR == r ? s : r);
  1090. X.fi
  1091. X.SH LICENSE
  1092. XThis program is free software; you can redistribute it and/or modify
  1093. Xit under the terms of the GNU General Public License version 1,
  1094. Xas published by the Free Software Foundation.
  1095. X.PP
  1096. XThis program is distributed in the hope that it will be useful,
  1097. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1098. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1099. XGNU General Public License for more details.
  1100. X.PP
  1101. XYou should have received a copy of the GNU General Public License
  1102. Xalong with this program; if not, write to the Free Software
  1103. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1104. X.SH AUTHOR
  1105. XHoward Gayle,
  1106. XTN/ETX/T/BG,
  1107. XEricsson Telecom AB,
  1108. XS-126 25 Stockholm,
  1109. XSweden,
  1110. Xhoward@ericsson.se,
  1111. Xuunet!ericsson.se!howard,
  1112. XPhone: +46 8 719 5565,
  1113. XFAX: +46 8 719 9598,
  1114. XTelex: 14910 ERIC S
  1115. END_OF_FILE
  1116. if test 1986 -ne `wc -c <'prefix.3'`; then
  1117.     echo shar: \"'prefix.3'\" unpacked with wrong size!
  1118. fi
  1119. # end of 'prefix.3'
  1120. fi
  1121. if test -f 'prefix.c' -a "${1}" != "-c" ; then 
  1122.   echo shar: Will not clobber existing file \"'prefix.c'\"
  1123. else
  1124. echo shar: Extracting \"'prefix.c'\" \(2122 characters\)
  1125. sed "s/^X//" >'prefix.c' <<'END_OF_FILE'
  1126. X/*
  1127. X * prefix - test if one string is prefix of another
  1128. X */
  1129. X
  1130. X#ifndef lint
  1131. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  1132. X#endif lint
  1133. X
  1134. X/*
  1135. X * This program is free software; you can redistribute it and/or modify
  1136. X * it under the terms of the GNU General Public License version 1,
  1137. X * as published by the Free Software Foundation.
  1138. X *
  1139. X * This program is distributed in the hope that it will be useful,
  1140. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1141. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1142. X * GNU General Public License for more details.
  1143. X *
  1144. X * You should have received a copy of the GNU General Public License
  1145. X * along with this program; if not, write to the Free Software
  1146. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1147. X */
  1148. X
  1149. X#include <stdio.h>
  1150. X#include <howard/port.h>
  1151. X#include <howard/version.h>
  1152. X
  1153. XMODVER ("@(#)$Header: prefix.c,v 1.5 89/08/13 16:55:44 howard Exp $");
  1154. X
  1155. X#include <howard/malf.h>
  1156. X#include <howard/registers.i>
  1157. X
  1158. XPUBLIC bStrT prefix (p, s)
  1159. XR1 bStrT p; /* The candidate prefix.*/
  1160. XR2 bStrT s; /* The string to test.*/
  1161. X
  1162. X/* Function:
  1163. X *    Test if p is a prefix of s.
  1164. X * Algorithm:
  1165. X *    Compare the strings character by character.
  1166. X * Returns:
  1167. X *    If p is a prefix of s, a pointer to the character in s
  1168. X *    just after the last character of the prefix.
  1169. X *    If p is not a prefix of s, NULBSTR.
  1170. X * Notes:
  1171. X *    
  1172. X */
  1173. X{
  1174. Xif (NULBSTR == p) malf1 ("prefix: NULL prefix");
  1175. Xif (NULBSTR == s) malf1 ("prefix: NULL string");
  1176. Xwhile ((EOS != B (*p)) && (*p == *s))
  1177. X   {
  1178. X   ++p;
  1179. X   ++s;
  1180. X   }
  1181. Xreturn ((EOS == B (*p)) ? s : NULBSTR);
  1182. X}
  1183. X
  1184. X#ifdef TEST
  1185. X#include <howard/usage.h>
  1186. X
  1187. XMAINVER ("@(#)$Header: prefix.c,v 1.5 89/08/13 16:55:44 howard Exp $");
  1188. XUSAGE ("prefix string");
  1189. X
  1190. XPUBLIC int main (argc, argv)
  1191. Xint    argc; /* Number of arguments.*/
  1192. XbStrT *argv; /* Points to array of argument strings.*/
  1193. X{
  1194. XbStrT r; /* Returned by prefix().*/
  1195. X
  1196. Xif (3 != argc) usage();
  1197. Xr = prefix (argv[1], argv[2]);
  1198. Xif (NULBSTR != r) PUTS (r);
  1199. XFFLUSH (stdout);
  1200. Xif (ferror (stdout)) malf1 ("Write error on Standard Output");
  1201. Xexit (SUCCESS);
  1202. X
  1203. X#ifdef lint
  1204. Xreturn (SUCCESS);
  1205. X#endif
  1206. X}
  1207. X#endif
  1208. END_OF_FILE
  1209. if test 2122 -ne `wc -c <'prefix.c'`; then
  1210.     echo shar: \"'prefix.c'\" unpacked with wrong size!
  1211. fi
  1212. # end of 'prefix.c'
  1213. fi
  1214. if test -f 'putspn.3' -a "${1}" != "-c" ; then 
  1215.   echo shar: Will not clobber existing file \"'putspn.3'\"
  1216. else
  1217. echo shar: Extracting \"'putspn.3'\" \(1957 characters\)
  1218. sed "s/^X//" >'putspn.3' <<'END_OF_FILE'
  1219. X.\" @(#)$Header: putspn.3,v 1.9 89/08/14 09:07:40 howard Exp $
  1220. X.TH PUTSPN "3 -lhoward" "$Revision: 1.9 $" "Howard\'s C library" "Howard\'s C library"
  1221. X.SH NAME
  1222. Xputspn \- write program name on standard error
  1223. X.SH SYNOPSIS
  1224. X.nf
  1225. X.BR "#include <" stdio.h ">"
  1226. X.BR "#include <" howard/port.h ">"
  1227. X.BR "#include <" howard/version.h ">"
  1228. X.PP
  1229. X.RI "MAINVER (" version ");"
  1230. X.fi
  1231. X.LP
  1232. X.BR "void " " putspn()"
  1233. X.SH COPYRIGHT
  1234. XCopyright \(co 1989 Howard Lee Gayle
  1235. X.SH DESCRIPTION
  1236. X.I Putspn
  1237. Xwrites the name of the executing program on standard error.
  1238. XIt takes the program name from the
  1239. X.I version
  1240. Xstring.
  1241. XThis string is expected to have the format
  1242. X.RI "[" x " ]" p "." y
  1243. Xwhere
  1244. X.I x
  1245. Xis an optional string without spaces,
  1246. X.I p
  1247. Xis the name of the program,
  1248. Xand
  1249. X.I y
  1250. Xis any string.
  1251. X.SH ENVIRONMENT
  1252. XIf the environment variable
  1253. XCMDNAME
  1254. Xis set and its value is not the empty string, then its value is
  1255. Xwritten first, followed by a colon.
  1256. XThis allows shell files to get their names into error messages
  1257. Xwritten by the C programs they call.
  1258. X.SH "SEE ALSO"
  1259. X.IR malf "(3 \-lhoward),"
  1260. X.IR usage "(3 \-lhoward)."
  1261. X.SH LICENSE
  1262. XThis program is free software; you can redistribute it and/or modify
  1263. Xit under the terms of the GNU General Public License version 1,
  1264. Xas published by the Free Software Foundation.
  1265. X.PP
  1266. XThis program is distributed in the hope that it will be useful,
  1267. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1268. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1269. XGNU General Public License for more details.
  1270. X.PP
  1271. XYou should have received a copy of the GNU General Public License
  1272. Xalong with this program; if not, write to the Free Software
  1273. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1274. X.SH AUTHOR
  1275. XHoward Gayle,
  1276. XTN/ETX/T/BG,
  1277. XEricsson Telecom AB,
  1278. XS-126 25 Stockholm,
  1279. XSweden,
  1280. Xhoward@ericsson.se,
  1281. Xuunet!ericsson.se!howard,
  1282. XPhone: +46 8 719 5565,
  1283. XFAX: +46 8 719 9598,
  1284. XTelex: 14910 ERIC S
  1285. X.PP
  1286. XThe idea for CMDNAME comes from C news, but all code is original.
  1287. END_OF_FILE
  1288. if test 1957 -ne `wc -c <'putspn.3'`; then
  1289.     echo shar: \"'putspn.3'\" unpacked with wrong size!
  1290. fi
  1291. # end of 'putspn.3'
  1292. fi
  1293. if test -f 'putspn.c' -a "${1}" != "-c" ; then 
  1294.   echo shar: Will not clobber existing file \"'putspn.c'\"
  1295. else
  1296. echo shar: Extracting \"'putspn.c'\" \(2284 characters\)
  1297. sed "s/^X//" >'putspn.c' <<'END_OF_FILE'
  1298. X/*
  1299. X * putspn - write short version of program name on standard error
  1300. X */
  1301. X
  1302. X#ifndef lint
  1303. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  1304. X#endif lint
  1305. X
  1306. X/*
  1307. X * This program is free software; you can redistribute it and/or modify
  1308. X * it under the terms of the GNU General Public License version 1,
  1309. X * as published by the Free Software Foundation.
  1310. X *
  1311. X * This program is distributed in the hope that it will be useful,
  1312. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1313. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1314. X * GNU General Public License for more details.
  1315. X *
  1316. X * You should have received a copy of the GNU General Public License
  1317. X * along with this program; if not, write to the Free Software
  1318. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1319. X */
  1320. X
  1321. X#include <stdio.h>
  1322. X#include <howard/port.h>
  1323. X#include <howard/version.h>
  1324. X
  1325. XMODVER ("@(#)$Header: putspn.c,v 1.10 89/08/13 16:31:09 howard Exp $");
  1326. X
  1327. X#include <howard/registers.i>
  1328. X#include <string.h>
  1329. X
  1330. XPUBLIC void putspn()
  1331. X
  1332. X/* Function:
  1333. X *    Write on the diagnostic output the name of the program.
  1334. X * Algorithm:
  1335. X *    The global variable _progn must be set up to the version
  1336. X *    string of the main program.  It has the format "x p.y z" where
  1337. X *    p is the program name.  The function skips x and any spaces
  1338. X *    after it, then prints p up to the terminal dot.
  1339. X * Notes:
  1340. X *    1) This function is called from malf() and usage().
  1341. X */
  1342. X{
  1343. XR1     bStrT cp;       /* Steps through program name.*/
  1344. Xextern bStrT _progn;   /* Version string.*/
  1345. Xextern cStrT getenv(); /* (3).*/
  1346. X
  1347. Xcp = (bStrT) getenv ("CMDNAME");
  1348. Xif ((NULBSTR != cp) && (EOS != B(*cp)))
  1349. X   FPRINTF (stderr, "%s:", cp);
  1350. Xcp = _progn;
  1351. Xif (NULBSTR != cp)
  1352. X   {
  1353. X   cp = (bStrT) strchr ((cStrT) cp, ' ');
  1354. X   if (NULBSTR == cp) cp = _progn;
  1355. X   else
  1356. X      {
  1357. X      while (' ' == B(*cp))
  1358. X         ++cp;
  1359. X      }
  1360. X   for (; (EOS != B(*cp)) && ('.' != B(*cp)); ++cp)
  1361. X      PUTC (B(*cp), stderr);
  1362. X   FPUTS (": ", stderr);
  1363. X   }
  1364. X}
  1365. X
  1366. X#ifdef TEST
  1367. X#include <howard/usage.h>
  1368. X
  1369. XMAINVER ("@(#)Header: test-putspn.c,v");
  1370. XUSAGE ("");
  1371. X
  1372. XPUBLIC int main (argc, argv)
  1373. Xint    argc; /* Number of arguments.*/
  1374. XbStrT *argv; /* Points to array of argument strings.*/
  1375. X{
  1376. Xif (1 != argc) usage();
  1377. Xputspn();
  1378. Xexit (SUCCESS);
  1379. X
  1380. X#ifdef lint
  1381. Xreturn (SUCCESS);
  1382. X#endif
  1383. X}
  1384. X#endif
  1385. END_OF_FILE
  1386. if test 2284 -ne `wc -c <'putspn.c'`; then
  1387.     echo shar: \"'putspn.c'\" unpacked with wrong size!
  1388. fi
  1389. # end of 'putspn.c'
  1390. fi
  1391. if test -f 'qrndu.3' -a "${1}" != "-c" ; then 
  1392.   echo shar: Will not clobber existing file \"'qrndu.3'\"
  1393. else
  1394. echo shar: Extracting \"'qrndu.3'\" \(2212 characters\)
  1395. sed "s/^X//" >'qrndu.3' <<'END_OF_FILE'
  1396. X.\" $Header: qrndu.3,v 1.1 89/08/14 10:46:02 howard Exp $
  1397. X.TH QRNDU "3 -lhoward" "$Revision: 1.1 $" "Howard\'s C library" "Howard\'s C library"
  1398. X.SH NAME
  1399. Xqrndr, qrnds, qrndu \- uniformly distributed quasi-random numbers in given range
  1400. X.SH SYNOPSIS
  1401. X.nf
  1402. X.BR "#include <" stdio.h ">"
  1403. X.BR "#include <" howard/port.h ">"
  1404. X.BR "#include <" howard/malf.h ">"
  1405. X.fi
  1406. X.LP
  1407. X.BR "void " "qrndr()"
  1408. X.LP
  1409. X.BR "void " "qrnds ("
  1410. X.IR seed )
  1411. X.nf
  1412. X.BI "unsigned " seed;
  1413. X.fi
  1414. X.LP
  1415. X.BR "long " "qrndu ("
  1416. X.IR low ,
  1417. X.IR high )
  1418. X.nf
  1419. X.BI "long " low;
  1420. X.BI "long " high;
  1421. X.fi
  1422. X.SH COPYRIGHT
  1423. XCopyright \(co 1989 Howard Lee Gayle
  1424. X.SH DESCRIPTION
  1425. X.I qrndu
  1426. Xreturns a uniformly distributed quasi-random number in the range
  1427. X.RI [ low ", " high ].
  1428. XBefore
  1429. X.I qrndu
  1430. Xis called, either
  1431. X.I qrndr
  1432. Xor
  1433. X.I qrnds
  1434. Xmust be called once for initialization.
  1435. X.I qrndr
  1436. Xinitializes to some value that is generally different for each process,
  1437. Xwhereas
  1438. X.I qrnds
  1439. Xis given an explicit
  1440. X.I seed
  1441. Xvalue.
  1442. X.PP
  1443. X.I qrndu
  1444. Xuses
  1445. X.IR random (3)
  1446. Xif it is available, otherwise
  1447. X.IR drand48 (3).
  1448. XIf neither are available, it uses
  1449. X.IR rand (3)
  1450. Xin desperation.
  1451. X.SH RETURNS
  1452. XA quasi-random number in the given range.
  1453. XOn error,
  1454. X.IR malf1 (3)
  1455. Xis called, so there is no return.
  1456. X.SH EXAMPLE
  1457. XThis code simulates a pair of dice:
  1458. X.nf
  1459. X   long pair;
  1460. X   qrndr();
  1461. X   pair = qrndu (1L, 6L) + qrndu (1L, 6L);
  1462. X.fi
  1463. X.SH "SEE ALSO"
  1464. X.IR drand48 (3),
  1465. X.IR malf "(3 \-lhoward),"
  1466. X.IR rand (3),
  1467. X.IR random (3).
  1468. X.SH LICENSE
  1469. XThis program is free software; you can redistribute it and/or modify
  1470. Xit under the terms of the GNU General Public License version 1,
  1471. Xas published by the Free Software Foundation.
  1472. X.PP
  1473. XThis program is distributed in the hope that it will be useful,
  1474. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1475. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1476. XGNU General Public License for more details.
  1477. X.PP
  1478. XYou should have received a copy of the GNU General Public License
  1479. Xalong with this program; if not, write to the Free Software
  1480. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1481. X.SH AUTHOR
  1482. XHoward Gayle,
  1483. XTN/ETX/T/BG,
  1484. XEricsson Telecom AB,
  1485. XS-126 25 Stockholm,
  1486. XSweden,
  1487. Xhoward@ericsson.se,
  1488. Xuunet!ericsson.se!howard,
  1489. XPhone: +46 8 719 5565,
  1490. XFAX: +46 8 719 9598,
  1491. XTelex: 14910 ERIC S
  1492. END_OF_FILE
  1493. if test 2212 -ne `wc -c <'qrndu.3'`; then
  1494.     echo shar: \"'qrndu.3'\" unpacked with wrong size!
  1495. fi
  1496. # end of 'qrndu.3'
  1497. fi
  1498. if test -f 'smpdig.c' -a "${1}" != "-c" ; then 
  1499.   echo shar: Will not clobber existing file \"'smpdig.c'\"
  1500. else
  1501. echo shar: Extracting \"'smpdig.c'\" \(1909 characters\)
  1502. sed "s/^X//" >'smpdig.c' <<'END_OF_FILE'
  1503. X/*
  1504. X * smpdig - add one digit to SMP
  1505. X */
  1506. X
  1507. X#ifndef lint
  1508. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  1509. X#endif lint
  1510. X
  1511. X/*
  1512. X * This program is free software; you can redistribute it and/or modify
  1513. X * it under the terms of the GNU General Public License version 1,
  1514. X * as published by the Free Software Foundation.
  1515. X *
  1516. X * This program is distributed in the hope that it will be useful,
  1517. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1518. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1519. X * GNU General Public License for more details.
  1520. X *
  1521. X * You should have received a copy of the GNU General Public License
  1522. X * along with this program; if not, write to the Free Software
  1523. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1524. X */
  1525. X
  1526. X#include <stdio.h>
  1527. X#include <howard/port.h>
  1528. X#include <howard/version.h>
  1529. X
  1530. XMODVER ("@(#)$Header: smpdig.c,v 1.6 89/08/14 17:52:43 howard Exp $");
  1531. X
  1532. X#include <errno.h>
  1533. X#include <howard/registers.i>
  1534. X#include <howard/simultipre.i>
  1535. X#include <howard/smp.h>
  1536. X
  1537. XPUBLIC boolT smpdig (d, rad, res)
  1538. X   int       d;   /* Digit to add.*/
  1539. XR3 unsigned  rad; /* Radix.*/
  1540. XR4 smpT     *res; /* Points to result.*/
  1541. X
  1542. X/* Function:
  1543. X *    res <- res * rad + d
  1544. X * Algorithm:
  1545. X *    Straightforward multiple precision with carry.
  1546. X * Returns:
  1547. X *    TRUE on success and FALSE on overflow.
  1548. X * Notes:
  1549. X *    
  1550. X */
  1551. X{
  1552. XR1 smpElT *p1; /* Steps through res->smp_el[].*/
  1553. XR2 smpElT *p2; /* Points to last element in res->smp_el[].*/
  1554. X
  1555. Xp1 = res->smp_el;
  1556. X*p1 = (*p1 * rad) + d;
  1557. Xfor (p2 = &res->smp_el[SMPNEL - 1]; p1 != p2; ++p1)
  1558. X   {
  1559. X   p1[1] = (p1[1] * rad) + (*p1 >> SMPEB);
  1560. X   *p1 &= SMPMASK;
  1561. X   }
  1562. Xreturn (0 == (*p1 >> SMPMHB));
  1563. X}
  1564. X
  1565. X#ifdef TEST
  1566. X#include <howard/usage.h>
  1567. X
  1568. XMAINVER ("@(#)$Header: smpdig.c,v 1.6 89/08/14 17:52:43 howard Exp $");
  1569. XUSAGE ("");
  1570. X
  1571. X#include <howard/malf.h>
  1572. X
  1573. XPUBLIC int main ()
  1574. X{
  1575. Xmalf1 ("Testing done in a2smp");
  1576. X
  1577. X#ifdef lint
  1578. Xreturn (SUCCESS);
  1579. X#endif
  1580. X}
  1581. X#endif
  1582. END_OF_FILE
  1583. if test 1909 -ne `wc -c <'smpdig.c'`; then
  1584.     echo shar: \"'smpdig.c'\" unpacked with wrong size!
  1585. fi
  1586. # end of 'smpdig.c'
  1587. fi
  1588. if test -f 'uMakefile' -a "${1}" != "-c" ; then 
  1589.   echo shar: Will not clobber existing file \"'uMakefile'\"
  1590. else
  1591. echo shar: Extracting \"'uMakefile'\" \(2218 characters\)
  1592. sed "s/^X//" >'uMakefile' <<'END_OF_FILE'
  1593. X# uMakefile - micro GNU make file for howard
  1594. X#
  1595. X# $Header: uMakefile,v 1.12 89/09/22 13:46:53 howard Exp $
  1596. X#
  1597. X# Copyright 1989 Howard Lee Gayle
  1598. X# This file is written in the ISO 8859/1 character set.
  1599. X#
  1600. X# This program is free software; you can redistribute it and/or modify
  1601. X# it under the terms of the GNU General Public License version 1,
  1602. X# as published by the Free Software Foundation.
  1603. X#
  1604. X# This program is distributed in the hope that it will be useful,
  1605. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1606. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1607. X# GNU General Public License for more details.
  1608. X#
  1609. X# You should have received a copy of the GNU General Public License
  1610. X# along with this program; if not, write to the Free Software
  1611. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1612. X
  1613. Xinclude MakeCommon
  1614. X
  1615. X# Commands:
  1616. X
  1617. X# Copy stdin to stdout.
  1618. XCAT=cat
  1619. X
  1620. X# Make depend file that shows include files that C functions use.
  1621. XDEPEND=mkLibIncl
  1622. X
  1623. X
  1624. X# Max radix for simple multiple precision system.  MUST be at least 16.
  1625. XSMPRDX=256
  1626. X
  1627. X
  1628. X# Sources:
  1629. X
  1630. X# Bourne shell.
  1631. XBS := $(filter %.b,$(SRCS))
  1632. X
  1633. X# C library functions.
  1634. XCS :=$(shell $(SETS) $(filter %.c,$(SRCS)) -d $(SCS))
  1635. X
  1636. X# C include files.
  1637. XHS := $(filter %.h,$(SRCS))
  1638. X
  1639. X
  1640. X# Targets:
  1641. X
  1642. X# Bourne shell
  1643. Xbt := $(subst .b,,$(BS))
  1644. X
  1645. X# Special C programs.
  1646. Xsct := $(subst .c,,$(SCS))
  1647. X
  1648. Xtargets := $(bt) $(sct) $(it) FREEZE.i Makefile depend
  1649. X
  1650. Xifdef WORK
  1651. X.DEFAULT:
  1652. X    $(UNCMPRS) $@
  1653. Xelse # WORK
  1654. X.DEFAULT:
  1655. X    $(DISTI) $@ $(DD)
  1656. Xendif # WORK
  1657. X
  1658. X.SUFFIXES:
  1659. X.PHONY: default
  1660. X
  1661. Xdefault: $(targets)
  1662. X
  1663. Xifndef WORK
  1664. XMakefile: $(DD)/Makefile
  1665. X    $(DISTI) $@ $(DD)
  1666. Xendif # WORK
  1667. X
  1668. X$(bt): %: %.b
  1669. X    $(RM) $@
  1670. Xifdef BDEFS
  1671. X    $(ECHO) '  $(BDEFS)' > $@
  1672. Xendif
  1673. X    $(CAT) $< >> $@
  1674. X    $(CHMOD) +x $@
  1675. X
  1676. Xcc-lims.i: mk-cc-lims
  1677. X    $(RM) $@
  1678. X    ./mk-cc-lims $(CC) $@
  1679. X    $(CHMOD) a=r $@
  1680. X
  1681. Xdepend: $(CS) $(HS) $(bt) $(it) FREEZE.i
  1682. X    $(DEPEND) "$(INCLUDES)" $(CS) > $@
  1683. X
  1684. XFREEZE.i: FREEZE mkFreeze
  1685. X    $(RM) FREEZE.*
  1686. X    ./mkFreeze
  1687. X    $(CHMOD) a=r FREEZE.*
  1688. X
  1689. Xlibc-lims.i: mkLibcLims
  1690. X    $(RM) $@
  1691. X    ./mkLibcLims $@
  1692. X    $(CHMOD) a=r $@
  1693. X
  1694. Xmk-smp: mk-smp.c
  1695. X    $(CC) -o $@ $(CFLAGS) -DSMPRDX=$(SMPRDX) $(INCLUDES) $<
  1696. X
  1697. Xregisters.i: mk-reg
  1698. X    $(RM) $@
  1699. X    ./mk-reg $(CC) $@
  1700. X    $(CHMOD) a=r $@
  1701. X
  1702. Xsimultipre.i: mk-smp
  1703. X    $(RM) $@
  1704. X    ./mk-smp > $@
  1705. X    $(CHMOD) a=r $@
  1706. X
  1707. END_OF_FILE
  1708. if test 2218 -ne `wc -c <'uMakefile'`; then
  1709.     echo shar: \"'uMakefile'\" unpacked with wrong size!
  1710. fi
  1711. # end of 'uMakefile'
  1712. fi
  1713. if test -f 'yrwk.3' -a "${1}" != "-c" ; then 
  1714.   echo shar: Will not clobber existing file \"'yrwk.3'\"
  1715. else
  1716. echo shar: Extracting \"'yrwk.3'\" \(2226 characters\)
  1717. sed "s/^X//" >'yrwk.3' <<'END_OF_FILE'
  1718. X.\" $Header: yrwk.3,v 1.2 89/08/14 10:09:58 howard Exp $
  1719. X.TH YRWK "3 -lhoward" "$Revision: 1.2 $" "Howard\'s C library" "Howard\'s C library"
  1720. X.SH NAME
  1721. Xyrwk \- compute year and ISO week from struct tm
  1722. X.SH SYNOPSIS
  1723. X.nf
  1724. X.BR "#include <" stdio.h ">"
  1725. X.BR "#include <" time.h ">"
  1726. X.BR "#include <" howard/port.h ">"
  1727. X.BR "#include <" howard/malf.h ">"
  1728. X.fi
  1729. X.LP
  1730. X.BR "unsigned " "yrwk ("
  1731. X.IR tmPtr ,
  1732. X.IR yearPtr )
  1733. X.nf
  1734. X.BI "struct tm *" tmPtr;
  1735. X.BI "unsigned *" yearPtr;
  1736. X.fi
  1737. X.SH COPYRIGHT
  1738. XCopyright \(co 1989 Howard Lee Gayle
  1739. X.SH DESCRIPTION
  1740. X.I yrwk
  1741. Xuses the tm_year, tm_yday, and tm_wday fields in the struct tm
  1742. Xto which
  1743. X.I tmPtr
  1744. Xpoints.
  1745. XIt computes the ISO week number corresponding to the given day,
  1746. Xand the year in which the week occurs.
  1747. XISO week number 1 is the first week in a year containing four
  1748. Xor more days in that year.
  1749. X.SH RETURNS
  1750. X.I yrwk
  1751. Xreturns the ISO week number.
  1752. XIf
  1753. X.I yearPtr
  1754. Xis not NULL, it also stores the year in which the ISO week
  1755. Xoccurs in the area to which
  1756. X.I yearPtr
  1757. Xpoints.
  1758. XThis is the complete year number; it is not biased by 1900 as
  1759. Xis tm_year.
  1760. X.SH EXAMPLE
  1761. XThis code writes the current ISO year and week.
  1762. X.nf
  1763. X   time_t ut; /* Current system time.*/
  1764. X   unsigned w; /* Week.*/
  1765. X   unsigned y; /* Year.*/
  1766. X   extern time_t time(); /* (3).*/
  1767. X
  1768. X   ut = time ((time_t *) NULL);
  1769. X   w = yrwk (localtime (&ut), &y);
  1770. X   PRINTF ("%u-%02u\en", y, w);
  1771. X.fi
  1772. X.SH "SEE ALSO"
  1773. X.IR ctime (3),
  1774. X.IR malf "(3 \-lhoward)."
  1775. X.SH LICENSE
  1776. XThis program is free software; you can redistribute it and/or modify
  1777. Xit under the terms of the GNU General Public License version 1,
  1778. Xas published by the Free Software Foundation.
  1779. X.PP
  1780. XThis program is distributed in the hope that it will be useful,
  1781. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1782. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1783. XGNU General Public License for more details.
  1784. X.PP
  1785. XYou should have received a copy of the GNU General Public License
  1786. Xalong with this program; if not, write to the Free Software
  1787. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1788. X.SH AUTHOR
  1789. XHoward Gayle,
  1790. XTN/ETX/T/BG,
  1791. XEricsson Telecom AB,
  1792. XS-126 25 Stockholm,
  1793. XSweden,
  1794. Xhoward@ericsson.se,
  1795. Xuunet!ericsson.se!howard,
  1796. XPhone: +46 8 719 5565,
  1797. XFAX: +46 8 719 9598,
  1798. XTelex: 14910 ERIC S
  1799. END_OF_FILE
  1800. if test 2226 -ne `wc -c <'yrwk.3'`; then
  1801.     echo shar: \"'yrwk.3'\" unpacked with wrong size!
  1802. fi
  1803. # end of 'yrwk.3'
  1804. fi
  1805. echo shar: End of archive 7 \(of 9\).
  1806. cp /dev/null ark7isdone
  1807. MISSING=""
  1808. for I in 1 2 3 4 5 6 7 8 9 ; do
  1809.     if test ! -f ark${I}isdone ; then
  1810.     MISSING="${MISSING} ${I}"
  1811.     fi
  1812. done
  1813. if test "${MISSING}" = "" ; then
  1814.     echo You have unpacked all 9 archives.
  1815.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1816. else
  1817.     echo You still need to unpack the following archives:
  1818.     echo "        " ${MISSING}
  1819. fi
  1820. ##  End of shell archive.
  1821. exit 0
  1822.  
  1823.